import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MiniProgramAuthenticationVO, MiniProgramAuthenticationForm, MiniProgramAuthenticationQuery } from '@/api/platform/miniProgramAuthentication/types';

/**
 * 查询小程序认证信息列表
 * @param query
 * @returns {*}
 */

export const listMiniProgramAuthentication = (query?: MiniProgramAuthenticationQuery): AxiosPromise<MiniProgramAuthenticationVO[]> => {
  return request({
    url: '/platform/miniProgramAuthentication/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询小程序认证信息详细
 * @param id
 */
export const getMiniProgramAuthentication = (id: string | number): AxiosPromise<MiniProgramAuthenticationVO> => {
  return request({
    url: '/platform/miniProgramAuthentication/' + id,
    method: 'get'
  });
};

/**
 * 新增小程序认证信息
 * @param data
 */
export const addMiniProgramAuthentication = (data: MiniProgramAuthenticationForm) => {
  return request({
    url: '/platform/miniProgramAuthentication',
    method: 'post',
    data: data
  });
};

/**
 * 修改小程序认证信息
 * @param data
 */
export const updateMiniProgramAuthentication = (data: MiniProgramAuthenticationForm) => {
  return request({
    url: '/platform/miniProgramAuthentication',
    method: 'put',
    data: data
  });
};

/**
 * 删除小程序认证信息
 * @param id
 */
export const delMiniProgramAuthentication = (id: string | number | Array<string | number>) => {
  return request({
    url: '/platform/miniProgramAuthentication/' + id,
    method: 'delete'
  });
};
